#include<bits/stdc++.h>
using namespace std;
int n,a[100010],m,t,s[100010];bool vis[100010];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	m=n;
	memset(s,0,sizeof(s));
	memset(vis,true,sizeof(vis));
	for(int j=1;j<=n;j++)
	{
		scanf("%d",&a[j]);
	}
	int t=a[1],i=2,sum=1;
	s[1]=1;
	while(m>0){
		while(s[i]!=0){
			i++;
		}
		if(t==a[i]){
			i++;
		}
		else{
			t=a[i];
			s[i]=sum;
			i++;
		}
		if(i>n){
			bool q=false;
			for(int j=1;j<=n;j++){
				if(s[j]==sum){
					q=true;
					m--;printf("%d ",j);
				}
			}
			if(q) printf("\n");
			t=a[1];
			i=++sum;
			if(s[sum]==0) s[sum]=sum;
		}
	}
	return 0;
}
